home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: fwrite help?
- Date: Thu, 22 Feb 96 00:41:44 GMT
- Organization: none
- Message-ID: <824949704snz@genesis.demon.co.uk>
- References: <4fmaig$7of@news.global1.net> <harmon.824165113@pegasus.montclair.edu> <danpop.824668361@rscernix> <4gf8f9$hmh@airdmhor.gen.nz>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4gf8f9$hmh@airdmhor.gen.nz>
- gumboot@airdmhor.gen.nz "Simon Hosie" writes:
-
- >In <harmon.824165113@pegasus.montclair.edu> harmon@pegasus.montclair.edu (Derek
- > Harmon) writes:
- >> first element in line, sizeof(char) for size insures compatibility on
- > machines
- >> where a character is more than one byte,
- >
- >Dan Pop:
- >> Nonsense. sizeof(char) is 1 _by definition_. The real reason behind
- >> writing sizeof(char) is to improve the readability of the code for the
- >> human reader. To the compiler, sizeof(char) and 1 are equivalent in most
- >> contexts (they have the same value, but different types).
- >
- > Oh I wish..
-
- Your wish has been granted! :-)
-
- >and the fact that I can argue against what you say just goes
- >to show (if you knew what I'd just done) how stupid I was. Watcom supports
- >multi-byte chars (this is what it calls them),
-
- The C language supports multibyte characters, but they don't (or needn't)
- have type char. wchar_t is defined in stddef.h for multibyte characters
- and 'is an integral type'.
-
- 6.3.3.4 The sizeof operator
-
- "The sizeof operator yields the size (in bytes) of its operand"
-
- "When applied to an operand that has type char, unsigned char, or signed char,
- (or a qualified version thereof) the result is 1."
-
- 3.4 byte
-
- "The unit of storage large enough to hold any member of the basic character
- set of the execution environment"
-
- 6.1.2.5 Types
-
- "An object declared as type char is large enough to store any member of the
- basic execution character set"
-
- >if a character is more than
- >one byte, then it would be very difficult to fit it in to one byte, would it
- >not?
-
- A byte (i.e. the units of the result of sizeof) in C is essentially defined
- to be that unit of memory occupied by 1 char.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-